﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using ECard.Models;
using System.Data;

namespace ECard.Controllers
{
    public class BookController
    {
        public BookModel GetBook(int NameID)
        {
            SqlConnection conn = ConnectDatabase.GetConnection();
            string query = "Select * from tbl_Name where NameID = "+NameID;
            SqlDataAdapter da = new SqlDataAdapter(query, conn);
            DataTable dt = new DataTable();
            conn.Open();
            da.Fill(dt);
            conn.Close();
            BookModel book = new BookModel();
            book.NameID = NameID;
            book.Name = dt.Rows[0]["Name"].ToString();
            return book;
        }

    }
}